home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / amos / AMOSList0993.lzh / AMOSLIST / 000261_amos-request@svcs1.digex.net_Mon Sep 27 21:44:50 1993.msg < prev    next >
Internet Message Format  |  1993-10-03  |  3KB

  1. Received: from nextsun.INS.CWRU.Edu by access.digex.net with SMTP id AA05364
  2.   (5.65c/IDA-1.4.4 for <mcox@access.digex.com>); Mon, 27 Sep 1993 21:44:46 -0400
  3. Received: from svcs1.digex.net by nextsun.INS.CWRU.Edu with SMTP (5.65b+ida+/CWRU-1.5.2-freenet-gw)
  4.     id AA10284; Mon, 27 Sep 93 21:44:25 -0400 (from amos-request@svcs1.digex.net for mcox@access.digex.com)
  5. Received: by svcs1.digex.net id AA03716
  6.   (5.65c/IDA-1.4.4 for amos-list-out); Mon, 27 Sep 1993 21:36:38 -0400
  7. Received: from access.digex.net by svcs1.digex.net with SMTP id AA03712
  8.   (5.65c/IDA-1.4.4 for <amos-list@svcs1.digex.net>); Mon, 27 Sep 1993 21:36:36 -0400
  9. Received: from vax.mbhs.edu by access.digex.net with SMTP id AA04243
  10.   (5.65c/IDA-1.4.4 for <amos-list@access.digex.net>); Mon, 27 Sep 1993 21:36:31 -0400
  11. Message-Id: <199309280136.AA04243@access.digex.net>
  12. Date: 27 Sep 93 21:34:00 EST
  13. From: "Andrew Church" <95ACHURCH@vax.mbhs.edu>
  14. Subject: Re: Use of Varptr
  15. To: "amos-list" <amos-list@access.digex.net>
  16. Status: RO
  17.  
  18. >  Last night I was stuffing around with passing Varptr's as parameters to
  19. >procedures, trying to pass the address of an array of floating point numbers.
  20. >The problem is that I couldn't just Poke(Varptr(ARRAY)+OFFSET) to get to
  21. >ARRAY(OFFSET).  I noticed that each successive Varptr was 4 units apart, and
  22. >this morning I realized why the values I Poked weren't what was stored.
  23. >  So could someone tell me 
  24.  
  25. >* How to use Varptr, Poke and Peek to store (properly) and read from an array
  26. >  of integers?
  27.  
  28.   Writing: Loke Varptr(ARRAY(0))+ELEMENT*4,_VALUE
  29.   Reading: _VALUE=Leek(Varptr(ARRAY(0))+ELEMENT*4)
  30.  
  31. where ELEMENT is the element number you're using, just like ARRAY(ELEMENT).
  32.  
  33.   Of course, this is only useful if you've passed the array address, as in
  34.  
  35. _PROCEDURE[Varptr(ARRAY(0))]
  36.  
  37. since otherwise you can just use _VALUE=ARRAY(ELEMENT).
  38.  
  39. >* How to use Varptr, Poke and Peek to store (properly) and read from an array
  40. >  of floats? (Ie, the set up of the float, such as the mantissa length...that
  41. >  sort of garbage, and where they are stored wrt the array's adress).
  42.  
  43.   They're also stored as 4-byte values, so use the same scheme I described
  44. above to access them.
  45.  
  46.   The format depends on whether you're using Creator or Pro.  Creator uses FFP:
  47.  
  48.   31                     876     0
  49.   | - - - mantissa - - - |S| exp |
  50.  
  51. where m is the mantissa (with an assumed binary point after the first digit),
  52. S is the sign bit and exp is the bias-64 exponent.  In other words,
  53.     exp = exponent+64
  54.  
  55.   Pro, on the other hand, uses IEEE single-precision.  I'm not entirely sure
  56. about the format for IEEE floats.  If you use Set Double Precision, that
  57. switches Pro to 8-byte double-precision floats, which is something completely
  58. different.
  59.  
  60.   --Andy Church
  61.